//
//  GYBaseNavigationController.m
//  GoodLuck
//
//  Created by apple on 2018/2/2.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

#import "GYBaseNavigationController.h"

@interface GYBaseNavigationController ()

@end

@implementation GYBaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

+ (void)initialize {
    UINavigationBar *navBar = [UINavigationBar appearance];
    //更改导航栏的半透明状态
    navBar.translucent = NO;
    NSDictionary *dict = @{NSForegroundColorAttributeName:[UIColor blackColor],
                           NSFontAttributeName:[UIFont systemFontOfSize:widthScale(18, iphone6_W)],
                           };
    [navBar setTitleTextAttributes:dict];
    //navBar.tintColor = [UIColor blackColor];
    navBar.barTintColor = NaviBGColor;
    
    
    UIBarButtonItem *item = [UIBarButtonItem appearance];
    [item setTitleTextAttributes:@{NSForegroundColorAttributeName:NaviTextColor} forState:UIControlStateNormal];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    //导航控制器的根控制器不算导航控制器里面的子控制器
    if (self.childViewControllers.count > 0) {
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"arrow_left_b" tagret:self action:@selector(back) button:nil];
    }
    [super pushViewController:viewController animated:animated];
}
- (void)back
{
    [self popViewControllerAnimated:YES];
}

@end
